package com.ideabove.adapter;

import java.util.ArrayList;
import java.util.List;

import com.ideabove.radio.R;
import com.ideabove.data.Comment;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CommentAdapter extends BaseAdapter
{

	private Context mContext;
	private int mResource;
	private List<Comment> mList;
	private LayoutInflater mInflater;    

	public CommentAdapter(Context c , ArrayList<Comment> arrays){
		this.mContext = c;
		this.mInflater = LayoutInflater.from(c);
		this.mList = arrays;
	}



	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		Comment comment = mList.get(position);

		if(convertView == null)
		{
			convertView = mInflater.inflate(R.layout.adapter_comment, null);
		
			TextView writer = (TextView) convertView.findViewById(R.id.comment_writer);
			TextView content = (TextView) convertView.findViewById(R.id.comment_content);
						
			writer.setText(comment.getFirst_name() + " " + comment.getLast_name());
			content.setText(comment.getComment());			
		}

		return convertView;
	}



	@Override
	public int getCount() {
		return mList.size();
	}
	@Override
	public Comment getItem(int position) {
		return mList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

}
